import Vue from 'vue'

function addInfo(ref, url, form, on, fuc) {
    ref.validate(async valid => {
        if (!valid) return
        const {data:res} = await Vue.prototype.$http.post(url,form)
        // console.log(res)
        if (res.meta.status !== 201) return Vue.prototype.$Message.error("添加失败")
        Vue.prototype.$Message.success("添加成功")
        on
        fuc()
    })
}

Vue.prototype.addInfo = addInfo